/**
 * Copyright © 2016-2024 The Thingsboard Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
:host {
  .tb-aggregated-value-card-panel {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 20px 24px 24px;
    > div:not(.tb-value-card-overlay) {
      z-index: 1;
    }
    .tb-aggregated-value-card-overlay {
      position: absolute;
      top: 12px;
      left: 12px;
      bottom: 12px;
      right: 12px;
    }
    > div.tb-aggregated-value-card-title-panel {
      display: flex;
      flex-direction: column;
      .tb-aggregated-value-card-subtitle {
        margin-left: 28px;
      }
    }
    .tb-aggregated-value-card-values, .tb-aggregated-value-card-chart {
      flex: 1;
      min-height: 0;
      overflow: hidden;
    }
    .tb-aggregated-value-card-values {
      padding: 8px 0;
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .tb-aggregated-value-card-values-container {
      width: 100%;
      height: 100%;
      position: relative;
      display: grid;
      grid-template-columns: minmax(0, 1fr) fit-content(100%) minmax(0, 1fr);
      .tb-aggregated-value-card-values-section {
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: hidden;
        &.left {
          align-items: flex-start;
        }
        &.center {
          align-items: center;
        }
        &.right {
          align-items: flex-end;
        }
      }
    }
    .tb-aggregated-value-card-chart {
      display: flex;
      gap: 8px;
      flex-direction: row;
      .tb-aggregated-value-card-chart-ticks {
        height: 100%;
        display: flex;
        flex-direction: column;
        place-content: flex-end space-between;
        align-items: flex-end;
        font-size: 11px;
        line-height: 16px;
        font-weight: 400;
        color: rgba(0, 0, 0, 0.38);
      }
      .tb-aggregated-value-card-chart-container {
        position: relative;
        flex: 1;
        min-width: 0;
        margin-top: 8px;
        margin-bottom: 8px;
        .tb-aggregated-value-card-chart-element {
          width: 100%;
          height: 100%;
        }
        .tb-aggregated-value-card-chart-boundary {
          position: absolute;
          width: 6px;
          height: 6px;
          &.top {
            top: 0;
            border-top: 2px solid rgba(0,0,0,0.38);
          }
          &.left {
            left: 0;
            border-left: 2px solid rgba(0,0,0,0.38);
          }
          &.right {
            right: 0;
            border-right: 2px solid rgba(0,0,0,0.38);
          }
          &.bottom {
            bottom: 0;
            border-bottom: 2px solid rgba(0,0,0,0.38);
          }
        }
      }
    }
    .tb-aggregated-value-card-value {
      white-space: nowrap;
      min-height: 0;
      display: flex;
      flex-direction: row;
      place-content: center;
      align-items: center;
      .value-arrow-container {
        display: flex;
      }
      .value-text {
        line-height: 1;
      }
      .value-arrow {
        font-size: 1.1em;
        height: 1.1em;
        line-height: 1.1em;
        min-width: 1em;
        width: 1em;
      }
      .units {
        font-size: 85%;
        padding-left: 0.2em;
        &.small {
          font-size: 50%;
        }
      }
    }
  }
}

:host ::ng-deep {
  .tb-aggregated-value-card-panel {
    > div.tb-aggregated-value-card-title-panel {
      .tb-widget-title {
        padding: 0;
      }
    }
  }
}
